const appTitle = '美刻创意魔方';

/**
 * @type {import('electron-builder').Configuration}
 * @see https://www.electron.build/configuration/configuration
 */
const config = {
  appId: 'com.meike.creative.desktop',
  productName: appTitle,
  directories: {
    output: 'release/${version}',
    buildResources: 'build'
    //output: 'dist-electron'
  },
  // 更新配置，主要用来生成lastest.yaml
  publish: [
    {
      provider: 'generic',
      url: ''
    }
  ],
  files: [
    'node_modules',
    'out',
    'resources'
    //'files',
    //'locales/en-US.pak',
    //'locales/zh-CN.pak'
  ],
  asarUnpack: ['**/*.{node,dll}'],
  asar: false,
  mac: {
    icon: './resources/icons/icon.icns',
    // 应用程序类型
    category: 'public.app-category.business',
    artifactName: '${productName}-${arch}-v${version}.${ext}',
    target: ['dmg']
  },
  dmg: {
    window: {
      width: 1200,
      height: 768
    },
    contents: [
      {
        x: 450,
        y: 330
      },
      {
        x: 820,
        y: 330,
        type: 'link',
        path: '/Applications'
      }
    ],
    title: appTitle + '-v${version}',
    background: './resources/background/background.png'
  },
  win: {
    icon: './resources/icons/icon.ico',
    artifactName: '${productName}-${arch}-v${version}.${ext}'
  },
  // https://github.com/electron-userland/electron-builder/issues/2363
  nsis: {
    include: 'build/installer.nsh',
    oneClick: false, // 是否一键安装
    allowToChangeInstallationDirectory: true, // 允许修改安装目录
    shortcutName: '创意魔方',
    shortcutName: '${productName}', // 图标名称
    uninstallDisplayName: '${productName}', // 卸载名称
    perMachine: true, // 是否开启安装时权限限制（此电脑或当前用户）
    installerIcon: './resources/icons/icon.ico', // 安装图标
    uninstallerIcon: './resources/icons/icon.ico', // 卸载图标
    installerHeaderIcon: './resources/icons/icon.ico', // 安装时头部图标
    createDesktopShortcut: 'always', // 创建桌面图标
    createStartMenuShortcut: true, // 创建开始菜单图标
    deleteAppDataOnUninstall: false // 卸载时清除用户数据
  },
  electronDownload: {
    mirror: 'https://npmmirror.com/mirrors/electron/'
  }
};

export default config;
